<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var product = [
        { title: "手机", price: 2200, num: 2 },
        { title: "电饭煲", price: 300, num: 5 },
        { title: "电冰箱", price: 5000, num: 1 },
      ];

        let dfb=(n)=>{
            let index
            product.forEach(item=>{
                if(item.title===n){
                    index=product.indexOf(item)
                }
            })
            return index
        }
        console.log(dfb('电饭煲'))
        let data=(price)=>{
            let arr=[]
            product.forEach(item=>{
                if(item.price>300){
                    arr.push(item)
                }
            })
            return arr
        }
        console.log(data(300))
        let _name=(price)=>{
            let arr=[]
            product.forEach(item=>{
                if(item.price>price){
                    arr.push(item.title)
                }
            })
            return arr
        }
        console.log(_name(1000))
    </script>
  </body>
</html>
